#ifndef __SCNS_JOYSTICK_H__
#define __SCNS_JOYSTICK_H__

#include "ScnsConfig.h"

#if defined(SCNS_JOYSTICK_ENABLE)&&SCNS_JOYSTICK_ENABLE==1

#include "ScnsBspJoystick.h"

#include "ScnsYing.h"

typedef enum
{
    SCNS_JOYSTICK_STATUS_OK=SCNS_YING_STATUS_OK,
    SCNS_JOYSTICK_STATUS_BEP_FAILED=SCNS_YING_STATUS_BSP_FAILED,
    SCNS_JOYSTICK_STATUS_FAILED=SCNS_YING_STATUS_FAILED,
    SCNS_JOYSTICK_STATUS_NOT_INITED,
}ScnsJoystickStatus;

typedef struct
{
    int16 x;
    int16 y;
}ScnsJoystickResult;

typedef struct
{
    uint16 ch[2];
}ScnsJoystickSource;

extern ScnsJoystickResult scnsJoystickResult[SCNS_JOYSTICK_MAX];

extern ScnsJoystickStatus scnsJoystickInit(ScnsJoystickEnum joystickN);
extern void scnsJoystickPrepareAllData(void);
extern void scnsJoystickInterrupt(ScnsJoystickEnum joystickN);
extern uint8 scnsJoystickBlockKey(ScnsJoystickEnum joystickN,uint8 block);
extern void scnsJoystickCorrection(ScnsJoystickEnum joystickN);

extern void scnsJoystickEncode(ScnsJoystickEnum joyN,uint8*buffer);
extern void scnsJoystickDecode(const uint8*buffer);

#if defined(SCNS_LCD_ENABLE)&&SCNS_LCD_ENABLE==1

#include "ScnsLcd.h"

void scnsJoystickDisplay(ScnsJoystickEnum joystickN,ScnsLcdLayer layN,Point plu,uint16 size);
#endif
#endif
#endif
